Skip to content

Instantly share code, notes, and snippets.

@edokeh
edokeh / index.js
Last active May 10, 2024 15:08
佛祖保佑,永无 BUG
//
// _oo0oo_
// o8888888o
// 88" . "88
// (| -_- |)
// 0\ = /0
// ___/`---'\___
// .' \\| |// '.
// / \\||| : |||// \
// / _||||| -:- |||||- \
@StephenFluin
StephenFluin / app.js
Created October 9, 2015 14:47
Sample Trello node.js Webhook Server
/**
* This is a sample webhook server that listens for webhook
* callbacks coming from Trello, and updates any cards that are
* added or modified so everyone knows they are "PRIORITY"
*
* To get started
* * Add your key and token below
* * Install dependencies via `npm install express request body-parser`
* * Run `node app.js` on a publicly visible IP
* * Register your webhook and point to http://<ip or domain>:3123/priority
@ziadoz
ziadoz / awesome-php.md
Last active May 10, 2024 15:06
Awesome PHP — A curated list of amazingly awesome PHP libraries, resources and shiny things.
@stevelacey
stevelacey / counties.php
Created April 18, 2012 08:45
UK Counties Array
<?php
// Source: http://www.carronmedia.com/uk-postal-counties-list
array(
'England' => array(
'Avon',
'Bedfordshire',
'Berkshire',
'Buckinghamshire',
@clemblanco
clemblanco / ST_RegexSearchMultiLine
Last active May 10, 2024 15:06
Sublime Text 2 Regex Multiline Search
<head>((?!</head>).|\n)+</head>
@billglover
billglover / defisheye.sh
Created May 13, 2015 05:28
De-Fisheye GoPro images
mogrify -path ./output -distort barrel '0.06335 -0.18432 -0.10618' ./*.JPG
@Alexisgt01
Alexisgt01 / CustomTelescopePrune.php
Created July 30, 2022 15:52
Laravel Telescope - Custom prune entries by type
<?php
namespace App\Console\Commands\Telescope;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;
use Laravel\Telescope\EntryType;
class CustomTelescopePrune extends Command
{
@stevelacey
stevelacey / middleware.py
Last active May 10, 2024 15:05 — forked from mindlace/middleware.py
UserstampMiddleware
# -*- coding: utf-8 -*-
from django.db.models import signals
from django.utils.functional import curry
from rest_framework import authentication
class UserstampMiddleware(object):
"""Add user created_by and updated_by foreign key refs to any model automatically.
Almost entirely taken from https://github.com/Atomidata/django-audit-log/blob/master/audit_log/middleware.py"""
def process_request(self, request):
<?php
namespace Application\BaseBundle\Doctrine\Listener;
use Doctrine\ORM\Event\LoadClassMetadataEventArgs;
class InheritanceMapping
{
protected $mappings;
@tclementdev
tclementdev / libdispatch-efficiency-tips.md
Last active May 10, 2024 15:05
Making efficient use of the libdispatch (GCD)

libdispatch efficiency tips

The libdispatch is one of the most misused API due to the way it was presented to us when it was introduced and for many years after that, and due to the confusing documentation and API. This page is a compilation of important things to know if you're going to use this library. Many references are available at the end of this document pointing to comments from Apple's very own libdispatch maintainer (Pierre Habouzit).

My take-aways are:

  • You should create very few, long-lived, well-defined queues. These queues should be seen as execution contexts in your program (gui, background work, ...) that benefit from executing in parallel. An important thing to note is that if these queues are all active at once, you will get as many threads running. In most apps, you probably do not need to create more than 3 or 4 queues.

  • Go serial first, and as you find performance bottle necks, measure why, and if concurrency helps, apply with care, always validating under system pressure. Reuse